package com.my.chapter8;

public class practice5 {
    public static void main(String[] args) {
        Cycle1 u = new Unicycle1();
        Cycle1 b = new Bicycle1();
        Cycle1 t = new Tricycle1();
        u.ride();
        b.ride();
        t.ride();
    }
}

class Cycle1{
    public void ride(){
        wheels();
        System.out.println("Cycle.ride()");
    }
    public void wheels(){
        System.out.print("轮子有0个；");
    }
}

class Unicycle1 extends Cycle1{
    public void ride(){
        wheels();
        System.out.println("Unicycle.ride()");
    }
    public void wheels(){
        System.out.print("轮子有1个；");
    }
}

class Bicycle1 extends Cycle1{
    public void ride(){
        wheels();
        System.out.println("Bicycle.ride()");
    }
    public void wheels(){
        System.out.print("轮子有2个；");
    }
}

class Tricycle1 extends Cycle1{
    public void ride(){
        wheels();
        System.out.println("Tricycle.ride()");
    }
    public void wheels(){
        System.out.print("轮子有3个；");
    }
}
